fn main() {
    let my_str = "hello";
    let my_string = String::from(my_str);
    println!("{}", my_string);
    let number = Number::from(232i32);
    println!("{:?}", number.value);
    let int = 5;
    let x: Number = int.into();
    println!("{:?}", x);
    let ff = 32f32;
    let x1: Number = ff.into();
    println!("{:?}", x1);
}

//From trait
#[derive(Debug)]
struct Number {
    value: i32,
}
impl From<i32> for Number {
    fn from(item: i32) -> Self {
        Number { value: item }
    }
}
impl From<f32> for Number {
    fn from(item: f32) -> Self {
        Number { value: item as i32 }
    }
}
//Into, 实现了From自然就有逆向操作，但要显示声明类型
